package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

public interface UserMapper {
    //通过手机号查找用户进行登录
    @Select("select * from user where phone=#{phone}")
    User login(User user);
    //如果数据库没有账号则创建一个
    @Insert("insert into user values (null,#{name},#{phone},#{sex},#{idNumber},#{avatar},#{status})")
    Integer add(User user);
    //根据用户id查找用户
    @Select("select * from user where id=#{id}")
    User findById(Long id);

}
